package com.nefu.huiyi.controller;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/auth")
public class AuthController {

    @PostMapping("/login")
    public ResponseEntity<String> login(@RequestParam String username, @RequestParam String password) {
        if ("ADMIN".equals(username) && "ADMIN".equals(password)) {
            return ResponseEntity.ok("登录成功，跳转到主页");
        } else if ("doctor".equals(username) && "doctor".equals(password)) {
            return ResponseEntity.ok("登录成功，跳转到医生页面");
        } else {
            return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("用户名或密码错误");
        }
    }
}

